package sk.uniza.fri.cerviix.server.network.messages.client;

import java.io.IOException;

import sk.uniza.fri.cerviix.server.Game;
import sk.uniza.fri.cerviix.server.game.Worm;
import sk.uniza.fri.cerviix.server.game.Worm.Direction;
import sk.uniza.fri.cerviix.server.network.Client;
import sk.uniza.fri.cerviix.server.network.ClientMessage;

public class WormDirectionMessage extends ClientMessage
{
	private byte direction;
	
	public WormDirectionMessage(Client client)
	{
		super(client);
	}
	
	@Override
	public void receive() throws IOException
	{
		direction = stream.readByte();
	}
	
	@Override
	public void run(Game game)
	{
		client.getPlayer().getWorm().setDirection(direction);
	}
}
